﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XLua;

[Hotfix]
public class HotfixTest
{
    public HotfixTest()
    {
        Debug.Log("C#构造函数热补丁测试");
    }

    public void PrintLog(string str)
    {
        Debug.Log(str);
    }

    ~HotfixTest()
    {

    }
}

[Hotfix]
public class HotFixMain : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        LuaManager.Instance.Init();
        LuaManager.Instance.DoLuaFile("Main");

        // 这样直接打印会报错
        Debug.Log(Add(1, 2));
        PrintLog("c#测试打印");

        // 构造函数热补丁的特点 和别的函数不同
        // 先调用原逻辑 再调用lua逻辑
        HotfixTest hotfixTest = new HotfixTest();
        hotfixTest.PrintLog("测试打印");
    }

    // Update is called once per frame
    void Update()
    {
     
    }

    public int Add(int a,int b)
    {
        return a + b;
    }

    public static void PrintLog(string str)
    {
        Debug.Log(str);
    }
}
